<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>js基础学习</title>

<!-- 导入外部js文件 -->
	<script type="text/javascript" src="js /demo2.js"></script>
	<script type="text/javascript">
	var str1 = '{"question":"《草原就是我的家》是哪个民族的民歌？","type":"单选题","optionnum":3,"option":"蒙古族|傣族|侗族","answernum":1,"answer":"蒙古族","weight":"2"}';
	function questiondata(){
	obj = JSON.parse(str1)
    console.log(obj.question)
    console.log(obj.option)
    console.log(obj.answer)
    var options = obj.option.split("|")
    console.log(options)
    options[0]
    options[1]
    options[2]
    document.write("<br><br><br>"+"1."+obj.question+ "<br>"); 
    document.write("A."+options[0]+ "<br>"+"B."+options[1]+"<br>"+"C."+options[2]+"<br>"+"<p>","参考答案: A.蒙古族"); 
  }



	var str2 = '{"question":"《草原就是我的家》是[]的[]歌曲？","type":"单空题","spacenum":2,"answernum":2,"answer":"蒙古族|民族","weight":"2"}'

	function questiondata2(){
    obj = JSON.parse(str2)
    console.log(obj.question)
    console.log(obj.option)
    console.log(obj.answer)
    var questions = obj.question.split("[]")
    console.log(questions)
    questions[0]
    questions[1]
    questions[2]
    document.write("<br><br>"+"2."+questions[0]+"<input>"+questions[1]+"<input>"+questions[2]+"<br>"+"<p>","参考答案:空1:蒙古族，空2:民族"); 

}

questiondata();
questiondata2();

	</script>	
</head>
<body bgcolor="background: #1E32FA;"></body>
<h3 style="position: absolute;top: 0;float: left;color: aliceblue;">2022年部分测试题</h3>

</html>